#include "FilledRect.h"

FilledRect::FilledRect()
{
	d_id = -1;
	canvas = NULL;
}
FilledRect::FilledRect(int _x, int _y, int _w, int _h, DrawingCanvas *_canvas)
{
	canvas = _canvas;
	d_id = canvas->addDrawing(Drawing(_x,_y,_x+_w,_y+_h,d_filledrect));
}
FilledRect::FilledRect(int _x, int _y, int _w, int _h, Color c, DrawingCanvas *_canvas)
{
	canvas = _canvas;
	d_id = canvas->addDrawing(Drawing(_x,_y,_x+_w,_y+_h,c,d_filledrect));
}
void FilledRect::setWidth(int _w)
{
	if(canvas != NULL)
		canvas->getDrawing(d_id).setWidth(_w);
}
void FilledRect::setHeight(int _h)
{
	if(canvas != NULL)
		canvas->getDrawing(d_id).setHeight(_h);
}
void FilledRect::setSize(Size s)
{
	if(canvas != NULL)
		canvas->getDrawing(d_id).setSize(s);
}
int FilledRect::getWidth()
{
	if(canvas != NULL)
		return canvas->getDrawing(d_id).getWidth();
	return -1;
}
int FilledRect::getHeight()
{
	if(canvas != NULL)
		return canvas->getDrawing(d_id).getHeight();
	return -1;
}
Size FilledRect::getSize()
{
	if(canvas != NULL)
		return canvas->getDrawing(d_id).getSize();
	return Size(0,0);
}
bool FilledRect::contains(int x, int y)
{
	if(canvas != NULL)
		return canvas->getDrawing(d_id).contains(x, y);
	return false;
}
